<%--
  Created by IntelliJ IDEA.
  User: 肖
  User:功能实现-许华钢
  Date: 2020/9/24
  Time: 22:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>精翼</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap-3.3.7-dist/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/footer.css"/>
    <script src="${pageContext.request.contextPath}/plugins/jquery/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/plugins/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                    data-target="#example-navbar-collapse">
                <span class="sr-only">切换导航</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="../index/index.jsp">精翼</a>
        </div>
        <div class="collapse navbar-collapse" id="example-navbar-collapse">

            <ul class="nav navbar-nav  navbar-right">
                <li ><a href="../sellCar/sellCar.jsp">我要卖车</a></li>
                <li><a href="../buyCar/buyCar.jsp">我要买车</a></li>
                <%--<li><a href="#">论坛</a></li>--%>
                <!-- <li><a href='#'><span class="badge pull-right" id='online_count'>1</span>在线人数</a></li> -->
                <li class="active"><a href="${pageContext.request.contextPath}/NavJsp/toIndex">首页</a></li>
                <!-- <li><a href='/success/user/exit'>安全退出</a></li> -->
                <li class="active" id="topname"></li>
                <li class="active"></li>
            </ul>
        </div>
    </div>
</nav>

<!-- 登录bigin -->
<div class="container">

    <div class="middle-box text-center loginscreen   animated fadeInDown">
        <div>
            <div>
                <h1 class="logo-name">J Y</h1>
            </div>
            <h3>欢迎登录 精翼  </h3>
            <form class="m-t" role="form">

                <div class="form-group"  style="width: 400px; margin-left: 370px;">
                    <input value='${username}' id="username"  name='username' type="text" class="form-control" placeholder="账号（用户为其手机号）" required="">
                </div>

                <c:if test="${error==1}">
                    <input type="text" value="账号有误，请重新输入" id="remind1" style="font-weight: bold;color: red;border: 0px solid">
                </c:if>
                <div class="form-group" style="width: 400px; margin-left: 370px;">
                    <input value='${password}' id="password"  name='password' type="password" class="form-control" placeholder="密码" required="">

                        <input type="text"  id="hidLog" style="font-weight: bold;color: red" class="" value="密码不符合要求，请重新填写">



                </div>
                <c:if test="${error==2}">
                    <input type="text" value="用户密码有误，请重新输入" id="remind1" style="font-weight: bold;color: red;border: 0px solid">
                </c:if>
                <c:if test="${error==3}">
                    <span id="remind3" style="font-weight: bold;color: red">销售员，你输入密码有误，在考虑一下吧</span>
                </c:if>
                <c:if test="${error==4}">
                    <span id="remind4" style="font-weight: bold;color: red">亲爱的管理员，你输入的密码有误</span>
                </c:if>

                <div class="form-group text-left" style="width: 400px; margin-left: 370px;">
                    <div class="checkbox i-checks">
                        <label class="no-padding">
                            <c:if test="${flag==true}">
                            <input checked id="flag" name="flag" type="checkbox">请记住我</label>
                        </c:if>
                        <c:if test="${flag!=true}">
                            <input id="flag" name="flag" type="checkbox">请记住我</label>
                        </c:if>
                        <a style="float: right" href="${pageContext.request.contextPath}/NavJsp/toLogin02">手机验证码登录</a>
<%--                            <input id="flag" name="flag" type="checkbox">请记住我</label>--%>
                    </div>
                </div>
                <button id="log" type="button" class="btn btn-primary block full-width m-b">登 录</button>

                <p class="text-muted text-center"><small>还没有账户？</small><a href="${pageContext.request.contextPath}/NavJsp/toRegister">点此注册</a>
                </p>

            </form>
        </div>
    </div>

</div>
<!-- 登录end -->


<!-- footer start -->



<!-- footer end -->
<script src="${pageContext.request.contextPath}/plugins/jquery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap-3.3.7-dist/js//bootstrap.js"></script>
<%--<script src="${pageContext.request.contextPath}/ajax/logRegist.js"></script>--%>
<script type="text/javascript"></script>
<script>

    $(function () {

        // 验证密码格式问题
        $("#hidLog").hide();

        $("#password").click(function () {
            $("#password").mouseout(function () {
                let pwd = $("#password").val();
                if((/^(\w){6,12}$/.test(pwd))){
                    $("#hidLog").hide();
                    return;
                }else {
                    $("#hidLog").show();
                    return;
                }
            })
        });

        $("#log").click(function () {
            let username = $("#username").val();
            let password = $("#password").val();
            let flag = null;
            var fl = document.getElementsByName("flag");
            for (i in fl){
                if (fl[i].checked){
                    flag = true;
                }
            }

            window.location = "/prj/logAndRegist/log/" + username + "/" + password + "/" + flag;
        })
    });
</script>
</body>
</html>